home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / lname.s < prev    next >
Encoding:
Text File  |  1993-10-04  |  4.0 KB  |  134 lines

  1. #! /bin/csh
  2. #  lname is a csh script to standardize long Fortran variable names
  3. #  using ISTLS.
  4. #
  5. #
  6. #  Invocation:
  7. #
  8. #  lname name_conversion_file Polish_option_file Fortran_source_file
  9. #
  10. #  Check command line validity
  11. if ( $#argv < 3 ) then
  12. TOOLPACKPATH/toolpack1.2/util/echoerr \
  13. Invocation:
  14. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  15. TOOLPACKPATH/toolpack1.2/util/echoerr \
  16. lname name_conversion_file Polish_option_file Fortran_source_file
  17. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  18. TOOLPACKPATH/toolpack1.2/util/echoerr \
  19. name_conversion_file contains a list of name conversions.  The user
  20. TOOLPACKPATH/toolpack1.2/util/echoerr \
  21. is prompted for replacements for long names that do not occur in
  22. TOOLPACKPATH/toolpack1.2/util/echoerr \
  23. name_conversion_file.  This file is created if it does not exist and
  24. TOOLPACKPATH/toolpack1.2/util/echoerr \
  25. is updated at the conclusion of the run.
  26. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  27. TOOLPACKPATH/toolpack1.2/util/echoerr \
  28. 'Polish_option_file is created by script "polx".'
  29. TOOLPACKPATH/toolpack1.2/util/echoerr \
  30. 'Note: "-" as Polish_option_file gives default options.'
  31. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  32. TOOLPACKPATH/toolpack1.2/util/echoerr \
  33. Transformed code is sent to standard output and may be redirected to a file.
  34. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  35. TOOLPACKPATH/toolpack1.2/util/echoerr \
  36. A file '"_.LOG"' showing the name changes by token number is created
  37. TOOLPACKPATH/toolpack1.2/util/echoerr \
  38. in the working directory.
  39. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  40.    exit
  41. endif
  42. #  Conversion file name.
  43. set conv = $1
  44. if ( -e $1 == 0 ) then
  45. TOOLPACKPATH/toolpack1.2/util/echoerr \
  46. "New conversion file: '$1'"
  47. endif
  48. #  "-" as Polish_option_file gives default options.
  49. if ( $2 != - ) then
  50. #  Check that Polish_option_file exists.
  51.    if ( -e $2 == 0 ) then
  52. TOOLPACKPATH/toolpack1.2/util/echoerr \
  53. "'$2' does not exist. '-' as the first argument gives default Polish options."
  54.       exit
  55.    endif
  56. endif
  57. #  Check that Fortran_source_file exists.
  58. if ( -e $3 == 0 ) then
  59. TOOLPACKPATH/toolpack1.2/util/echoerr \
  60. "'$3' does not exist."
  61.    exit
  62. endif
  63. #
  64. #  Create PFS.  If PFS already exists, exit with an advisory message.
  65. #
  66. if ( -e _.TOOLPACK == 0 ) then
  67.    mkdir _.TOOLPACK
  68. else
  69. TOOLPACKPATH/toolpack1.2/util/echoerr \
  70. Toolpack-created directory '"_.TOOLPACK"' exists. \
  71. Remove with script '"discard"'.
  72.    exit
  73. endif
  74. #  Make a tab-free copy of the Fortran source and use it as source.
  75. set src = lx.src$$
  76. expand $3 > _.TOOLPACK/$src
  77. #  Lexer token stream file name.
  78. set tkn = _.lxtkn
  79. #  Lexer comment file name.
  80. set cmt = _.lxcmt
  81. #  Create the interprocess file IST.CMD and append parameters for ISTLX.
  82. TOOLPACKPATH/toolpack1.2/util/mkipf \
  83. $src - $tkn $cmt
  84. #
  85. #  Invoke ISTLX.
  86. #
  87. TOOLPACKPATH/toolpack1.2/exec/istlx.u
  88. #
  89. #  If lexer errors are reported, advise user to obtain listing and exit.
  90. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  91. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  92. TOOLPACKPATH/toolpack1.2/util/echoerr \
  93. 'Program has lexical scanning errors.  Invoke script "getlst"'
  94. TOOLPACKPATH/toolpack1.2/util/echoerr \
  95. to obtain a listing showing statement and token numbers.
  96. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  97.    /bin/rm -r _.TOOLPACK
  98.    exit
  99. endif
  100. #  Files for output token stream.
  101. set tknout = _.lstkn$$
  102. set cmtout = _.lscmt$$
  103. #  Log file.
  104. set log = _.lslog$$
  105. #  Create the interprocess file IST.CMD and append parameters for ISTLS.
  106. TOOLPACKPATH/toolpack1.2/util/mkipf \
  107. $tkn $cmt $tknout $cmtout \#$conv $log
  108. #
  109. #  Invoke ISTLS.
  110. #
  111. TOOLPACKPATH/toolpack1.2/exec/istls.u
  112. #
  113. #  Invoke Polish to unscan and format transformed code.
  114. if ( $2 == - ) then
  115. TOOLPACKPATH/toolpack1.2/util/mkipf \
  116. $tknout $cmtout \#1 -
  117. else
  118. TOOLPACKPATH/toolpack1.2/util/mkipf \
  119. $tknout $cmtout \#1 \#$2
  120. endif
  121. #
  122. #  Invoke ISTPL.
  123. #
  124. TOOLPACKPATH/toolpack1.2/exec/istpl.u
  125. #
  126. TOOLPACKPATH/toolpack1.2/util/echoerr \
  127. See log of token changes in file '"_.LOG"'.
  128. TOOLPACKPATH/toolpack1.2/util/echoerr \
  129. A listing showing token numbers can be obtained by running script '"getlst"'.
  130. mv _.TOOLPACK/$log _.LOG
  131. #
  132. /bin/rm -r _.TOOLPACK
  133. #
  134.